package com.jin.spirng_boot_learn.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

//@Component
//@Aspect
public class LogAspect {

    @Pointcut("execution(* com.jin.spirng_boot_learn.controllers..*.*(..))")
    public void logPointCut() {

    }

    //
    @Before(value ="logPointCut()")
    public void beforeLogin(JoinPoint joinpoint) {
        System.out.println("before execute---------------------------------------");
    }

    @AfterReturning(value = "logPointCut()",returning = "abc")
    public void afterLogin(JoinPoint joinpoint, Object abc) {
        System.out.println(abc);
        System.out.println("after execute---------------------------------------");
    }

    @Around(value="logPointCut()")
    public void AroudLogin(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("around before --------------------------------");
        proceedingJoinPoint.proceed();
        System.out.println("around after --------------------------------");

    }

}
